package com.cdd.agent.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cdd.common.domain.entity.AgentUserRecords;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AgentUserRecordsMapper extends BaseMapper<AgentUserRecords> {

    @Select("select r.*,u.sex from agent_user_records r " +
            " left join app_user u on r.userId = u.id" +
            " where r.parentUserId = #{parentUserId}")
    List<AgentUserRecords> list(int parentUserId);

    @Select("select r.*,u.sex from agent_user_records r " +
            " left join app_user u on r.userId = u.id" +
            " where r.parentUserId = #{parentUserId} " +
            " and to_days(r.createTime) = to_days(now())")
    List<AgentUserRecords> todayNewUser(Integer parentUserId);

}